

function say() {
    alert("LC:1288. 删除被覆盖区间");
}
say();


/**
 * @param {number[][]} intervals
 * @return {number}
 */
var removeCoveredIntervals = function(intervals) {
    //11:00-15   10:24-40
    sort(intervals)
    for(var i = 0; i < intervals.length; i++){
        for(var j = i + 1; j < intervals.length; j++){
            if(intervals[i][0] <= intervals[j][0] &&
            intervals[i][1] >= intervals[j][1]){
                intervals.splice(j,1)
                j--
            }
        }
    }

    return intervals.length
};

function sort(arr){
    for(var i = 0; i < arr.length; i++){
        for(var j = 0; j < arr.length - 1 - i; j++){
            var item = arr[j]
            var width = item[1] - item[0]
            var next = arr[j + 1]
            var nextWidth = next[1] - next[0]
            if(width < nextWidth){
                arr[j] = arr[j + 1]
                arr[j + 1] = item
            }
        }
    }
}
